import xcRequest from '@/service'
import {
  userInfoType,
  loginResponseType,
  loginResDataType
} from '@/service/login/type'
enum loginInfo {
  loginUrl = '/login',
  userInfoUrl = '/users/',
  userMenu = '/role/'
}

export function loginRequest(userInfo: userInfoType) {
  return xcRequest.post<loginResponseType<loginResDataType>>({
    url: loginInfo.loginUrl,
    data: userInfo
  })
}
export function getUserInfoRequest(id: number) {
  return xcRequest.get<loginResponseType>({
    url: loginInfo.userInfoUrl + id
  })
}
export function getUserMenuRequest(id: number) {
  return xcRequest.get<loginResponseType>({
    url: loginInfo.userMenu + id + '/menu'
  })
}
